import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        String str = scan.nextLine();
        //1.字符串分割   split()
        String[] array = array = str.split(" ");
        int len = array[array.length-1].length();
        System.out.println(len);
        //2.找到最后一个空格的下标，然后截取空格后的字符串，然后求长度  lastindexOf()  subString()
        int i = str.lastIndexOf(str.length()-1,' ');
        str.substring(i+1).length();
        System.out.println(len);
    }
}